﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
namespace JTicket.UI.Service
{
    /// <summary>
    /// Summary description for JT_CodeNote
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    [GenerateScriptType(typeof(JTicket.Model.C_CodeNote))]
    public class JT_CodeNote : System.Web.Services.WebService
    { 
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// 
        [WebMethod]
        public string AddTitleSort(string CodeNote, string CodeVal)
        {

            if (!BLL.C_CodeNote.Exists("TitleSort", CodeVal))
            {
                JTicket.Model.C_CodeNote model = new Model.C_CodeNote();
                model.CodeNote = CodeNote;
                model.CodeVal = CodeVal;
                model.GroupCode = "TitleSort";
                model.GroupName = "演出类别";
                model.UseFlag = '0';
                BLL.C_CodeNote.Add(model);
                return "添加成功！";
            }
            else
                return "改类别编号已存在！";
        }


       
        [WebMethod]
        public JTicket.Model.C_CodeNote GetModel(string CodeVal)
        {
            BLL.C_CodeNote bllCodeNote = new BLL.C_CodeNote();
            return bllCodeNote.GetModel("TitleSort", CodeVal);

        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// 
        [WebMethod]
        public void Update(string CodeNote, string CodeVal)
        {
            JTicket.Model.C_CodeNote model = new Model.C_CodeNote();
            model.CodeNote = CodeNote;
            model.CodeVal = CodeVal;
            model.GroupCode = "TitleSort";
            model.GroupName = "演出类别";
            model.UseFlag = '0';
            BLL.C_CodeNote.Update(model);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// 
        [WebMethod]
        public void Delete(string CodeVal)
        {
            try
            {
                BLL.C_CodeNote.Delete("TitleSort", CodeVal);
            }
            catch
            {
            }
        }


        /// <summary>
        /// 用户等级
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public List<Model.C_CodeNote> OperLevel()
        {  

            return BLL.C_CodeNote.GetListAllByGroupCod(
                JTicket.Data.Enum.GroupName.OperLevel.ToString());
        }
        /// <summary>
        /// 用户状态
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public List<Model.C_CodeNote> OperStatus()
        {

            return BLL.C_CodeNote.GetListAllByGroupCod(
                JTicket.Data.Enum.GroupName.OperStatus.ToString());
        }
    }
}
